<?php
 include "includeFiles.php";
?>
<link href="../css/style.css" rel="stylesheet" type="text/css" />
<link href="../css/edit.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../js/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="../js/aduf.js"></script>
<script src="../js/checkSubmit.js"></script>
<script language="javascript">
    function checkContent(dom){
        //if(!check_empty(dom.guest_name,"姓名不能为空！")) return false;
        //if(!check_isnum(dom.guest_name,"姓名只能为数字！")) return false;
        //if(!check_istel(dom.guest_contact,"请输入正确的联系电话，只可以由数字和“/”和“-”组成！")) return false;
        //if(!check_isemail(dom.guest_email,"邮箱格式不正确！")) return false;
        return true;
    }
</script>
<?php
include_once("../../class/aduf.class.php");
$aduf = new Audf();
if ($_POST[action] == "add") {
    $aduf->actionAdd(Code_dinner);
}elseif ($_POST[action] == "update") {
    $aduf->actionUpdate(Code_dinner,id);
}
?>


<table  id="pagehead" cellpadding="0" cellspacing="0" border="0" width="100%">
    <tr>
        <td width="23%"><h1>3g套餐管理</h1></td>
        <td width="77%" class="actions"><table  cellpadding="0" cellspacing="0" border="0" align="right">
                <tr>
                    <td class="active"><a href="3g_dinner_admin_list.php" class="view">管理列表</a></td>
                    <td ><a href="3g_dinner_add.php" class="edit">新增</a></td>
                </tr>
            </table></td>
    </tr>
</table>

<form action="3g_dinner_add.php" method="post" onsubmit="return checkContent(this);">
    <? if ($_GET["id"]) { ?>
        <input name="action" type="hidden" value="update" />
        <input name="id" type="hidden" value="<?=$_GET["id"]?>" />

        <?
        $SQL2 = " select * from Code_dinner where id = $id ";
        $objDb->query($SQL2);
        $msg = $objDb->get_data();
        ?>

    <? } else { ?>
        <input name="action" type="hidden" value="add" />
    <? } ?>
    <table cellspacing="0" cellpadding="0" width="100%"  class="maintable" id="feedbackTable">
        <?
        $SQL3 = "  select COLUMN_NAME,column_comment from INFORMATION_SCHEMA.Columns where table_name= 'Code_dinner' and table_schema='taoshop' ";
        $objDb->query($SQL3);
        $result = $objDb->get_data();
        if ($result) {
            foreach ($result as $key => $value) {
                if ($key == 0)
                    continue;
                ?>  <tr><td>

                        <label> <?php echo $value["column_comment"]; ?></label></td>
                    <td>
                        <input name="<?= $value["COLUMN_NAME"] ?>" id="<?= $value["COLUMN_NAME"] ?>"  type="text" value="<?= $msg[0][$value["COLUMN_NAME"]] ?>" />
                    </td> </tr>
    <? }
} ?>
        <tr><td colspan="2">
        <center>
            <input type="submit" value="提交" />
        </center>
        </td></tr>
    </table>
</form>
